﻿<UserControl
    x:Class="Membership.UI.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
    xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <UserControl.Resources>
        <!-- 列表右上角工具栏文字样式-->
        <Style x:Key="BannerHyperLinkStyle" TargetType="HyperlinkButton">
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Opacity" Value="0.9"/>

        </Style>

        <!-- 菜单动画-->
        <Storyboard x:Name="hideMenu">
            <DoubleAnimation Storyboard.TargetName="LeftPanel" Storyboard.TargetProperty="Width" To="26" Duration="0:0:0.3"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="CollapseImage" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.1"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="ExpandImage" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="LeftMenuPanel" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2"></DoubleAnimation>
        </Storyboard>
        <Storyboard x:Name="showMenu">
            <DoubleAnimation Storyboard.TargetName="LeftPanel" Storyboard.TargetProperty="Width" To="170" Duration="0:0:0.3"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="CollapseImage" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="ExpandImage" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.1"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="LeftMenuPanel" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"></DoubleAnimation>
        </Storyboard>

    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid Background="#dfe8f6">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid Grid.ColumnSpan="2" Height="36" Background="#1C3E7E">
                <TextBlock  HorizontalAlignment="Left"  Margin="15,0,0,0"  VerticalAlignment="Center"
                            Foreground="White"    FontSize="16" Text="人员管理系统(银光版)"/>

                <HyperlinkButton Style="{StaticResource BannerHyperLinkStyle}"  Margin="0,0,75,0" NavigateUri="/Views/Home.xaml" 
                                 TargetName="ContentFrame" Content="主页" />
                <HyperlinkButton Style="{StaticResource BannerHyperLinkStyle}" Margin="0,0,45,0" NavigateUri="/Views/Home.xaml" 
                                 TargetName="ContentFrame" Content="帮助" />
                <HyperlinkButton Style="{StaticResource BannerHyperLinkStyle}" Margin="0,0,15,0" NavigateUri="/Views/About.xaml" 
                                 TargetName="ContentFrame" Content="关于" />

            </Grid>
            <Border Grid.ColumnSpan="2" Grid.Row="1" BorderBrush="#99bbe8" BorderThickness="1,1,1,1">
                <Grid  Height="26"  Background="#D5E2F2">
                    <Image Source="Images/a.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="10,0,0,0" />
                    <Image Source="Images/b.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="30,0,0,0" />
                    <Image Source="Images/c.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="50,0,0,0" />
                    <Image Source="Images/d.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="70,0,0,0" />
                    <Image Source="Images/e.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="90,0,0,0" />
                    <Image Source="Images/a.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="110,0,0,0" />
                    <Image Source="Images/b.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="130,0,0,0" />
                    <Image Source="Images/c.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="150,0,0,0" />
                    <Image Source="Images/d.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="170,0,0,0" />
                    <Image Source="Images/e.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="190,0,0,0" />
                    <Image Source="Images/a.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="210,0,0,0" />
                    <Image Source="Images/b.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="230,0,0,0" />
                    <Image Source="Images/c.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="250,0,0,0" />
                    <Image Source="Images/d.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="270,0,0,0" />
                    <Image Source="Images/e.png" HorizontalAlignment="Left" Cursor="Hand" Stretch="None" Margin="290,0,0,0" />
                    <TextBlock x:Name="UserInfoTextBlock"  HorizontalAlignment="Right" FontSize="12" VerticalAlignment="Center"  Margin="0,0,15,0" Text="冯瑞涛 管理员 注销" />
                </Grid>
            </Border>
            <Grid Grid.Row="2" Grid.Column="0" Margin="5">
                <Border x:Name="LeftPanel" Width="170" BorderBrush="#99bbe8" BorderThickness="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="*"></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid Height="26" Grid.Row="0">
                            <Image Source="Images/leftTitle_bg.png" Stretch="Fill"/>
                            <TextBlock Margin="6" FontSize="12" Text="系统功能"/>
                            <Image x:Name="ExpandImage" Source="Images/leftShow_icon.png" Stretch="None" Margin="3" HorizontalAlignment="Right" Opacity="0"/>
                            <Image x:Name="CollapseImage" Source="Images/leftHide_icon.png" Stretch="None" Margin="3" HorizontalAlignment="Right" Opacity="1" Cursor="Hand" MouseLeftButtonUp="CollapseImage_MouseLeftButtonUp"/>
                        </Grid>
                        <Border Height="1" Grid.Row="1" Background="#99bbe8" />
                        <Grid Grid.Row="2" Background="White" x:Name="LeftMenuPanel">
                            <sdk:TreeView x:Name="MenuTreeView" BorderThickness="0" Background="#F5F5F5" FontSize="12">
                                <sdk:TreeView.ItemTemplate>
                                    <sdk:HierarchicalDataTemplate ItemsSource="{Binding Childrens}">
                                        <StackPanel>
                                            <HyperlinkButton  NavigateUri="{Binding PageURL }" TargetName="ContentFrame" Content="{Binding FunctionName}" Foreground="Black"/>
                                        </StackPanel>
                                    </sdk:HierarchicalDataTemplate>
                                </sdk:TreeView.ItemTemplate>
                            </sdk:TreeView>
                        </Grid>
                    </Grid>
                </Border>
            </Grid>
            <Grid Grid.Row="2" Grid.Column="1" Margin="5">
                <Border x:Name="rightPanel" BorderBrush="#99bbe8" BorderThickness="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="*"></RowDefinition>
                        </Grid.RowDefinitions>

                        <ScrollViewer Grid.Row="1"  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderThickness="0">
                            <navigation:Frame x:Name="ContentFrame" 
                               Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
                                <navigation:Frame.UriMapper>
                                    <uriMapper:UriMapper>
                                        <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>
                                    </uriMapper:UriMapper>
                                </navigation:Frame.UriMapper>
                            </navigation:Frame>
                        </ScrollViewer>
                    </Grid>
                </Border>
            </Grid>
        </Grid>
    </Grid>


</UserControl>